import 'package:flutter/material.dart';
import 'package:top_foundation/top_foundation.dart';
import 'package:whale/helper/component/base/refresh/view.dart';
import 'package:whale/pages/refresh_demo/model.dart';

import 'index.dart';

class RefreshDemoPage extends IRefreshView<RefreshDemoController> {
  const RefreshDemoPage({Key? key}) : super(key: key);

  @override
  Widget buildRefreshBody(BuildContext context) {
    return ListView.builder(
      itemBuilder: (context, index) {
        var m = controller.state.page!.records![index] as RefreshDemoModel;
        return ListTile(
          title: Text('$index'),
          subtitle: Text(m.participants ?? ''),
        );
      },
      itemCount: controller.state.page?.records?.length ?? 0,
    );
  }

  @override
  Widget buildView(BuildContext context, Widget refreshBody) {
    return Scaffold(
      appBar: detailAppBar(context, title: '刷新demo'),
      body: refreshBody,
    );
  }

  // @override
  // Widget build(BuildContext context) {
  //   return Scaffold(
  //     appBar: detailAppBar(context),
  //     body: EasyRefresh(
  //       controller: controller.state.controller,
  //       header: BezierCircleHeader(
  //           backgroundColor: ITheme.selectedColor.withAlpha(20)),
  //       onRefresh: controller.onRefresh,
  //       child: buildRefreshBody(context),
  //     ),
  //   );
  // }
}
